package com.example.logdemo;

import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.rolling.RollingFileAppender;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.ILoggerFactory;
import org.slf4j.impl.StaticLoggerBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.nio.charset.Charset;

/**
 * @author cxx
 * @create 2021-02-24 15:10
 **/
@RestController
@RequestMapping("/")
@Slf4j
public class DemoController {

    @RequestMapping("/t")
    public String test(){
        log.info ("aaasd");
//        new Thread (()->{
//            Logger logger = getLoggerContext ().getLogger ("ROOT");
//            Iterator<Appender<ILoggingEvent>> iterator = logger.iteratorForAppenders();
//            while (iterator.hasNext()) {
//                Appender<ILoggingEvent> app = iterator.next();
//                if (app instanceof ConsoleAppender) {
//                    logger.detachAppender(app);
//                }
//            }
//        }).start ();


        return "aaa";
    }



}
